<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        class Animal {
            constructor(name) {
                this.name = name;
                this.eatables = [];
            }
            eat(food) {
                this.eatables.push(food);
            }
            speak() {
                console.log(`hi,I am ${this.name}`);
            }
        }

        class Dog extends Animal {
            constructor(name, age) {
                super(name);
                this.age = age;
            }
            bark() {
                console.log(`bark bark!`);
            }
            speak() {
                console.log(`bark bark! I am ${this.name}`);
            }
        }

        const lucy = new Dog('lucy', 3);
    </script>
</body>

</html>